;; EX-51.scn - SPE-1 (JMcC)

(synthdef-send
 (synthdef
  "SPE-1"
  ((out 0 0 0) (freq 440 0 1))
  (seq (signal (RLPF.ar (LFSaw.ar freq mul: (EnvGen.kr envelope: (Env.perc)
						       levelScale: 0.1
						       doneAction: 2))
			(MIDICPS (LFNoise1.kr 1 36 110))
			0.1))
       (AllpassN.ar signal 0.05 (list (random 0.05) (random 0.05)) 4)
       (AllpassN.ar signal 0.05 (list (random 0.05) (random 0.05)) 4)
       (AllpassN.ar signal 0.05 (list (random 0.05) (random 0.05)) 4)       
       (AllpassN.ar signal 0.05 (list (random 0.05) (random 0.05)) 4)
       (Out.ar out signal))))

(schedule-start)

(@ (lambda (pulse time)
     (let ((note (random '(0 2 3 5 7 10 12) '(3 1 1 1 1 1)))
	   (octave (random '(-3 0 1) '(1 4 2))))
       (=> time 
	   (list "/s_new" "SPE-1" -1 1 1 "freq" (midi-note->frequency (+ 65 note (* 12 octave)))))
       (random '(0.1 0.2 0.4) '(6 2 1)))))
